# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php82-spx
_extname=spx
pkgver=0.4.17
pkgrel=0
pkgdesc="A simple & straight-to-the-point PHP 8.2 profiling extension with its built-in web UI"
url="https://github.com/NoiseByNorthwest/php-spx"
arch="x86_64 aarch64"
license="GPL-3.0-or-later"
_phpv=82
_php=php$_phpv
depends="$_php-common"
makedepends="$_php-dev zlib-dev"
checkdepends="$_php-cgi"
source="php-$_extname-$pkgver.tar.gz::https://github.com/NoiseByNorthwest/php-spx/archive/v$pkgver.tar.gz"
builddir="$srcdir/php-$_extname-$pkgver"

build() {
	phpize$_phpv
	./configure --prefix=/usr --with-php-config=php-config$_phpv
	make
}

check() {
	TEST_PHP_CGI_EXECUTABLE=/usr/bin/php-cgi$_phpv \
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test TESTS=--show-diff
	$_php -d extension=modules/$_extname.so --ri $_extname
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/$_php/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/$_extname.ini
}

sha512sums="
e668eb91caba5edd13bf4d67cc59d571c15920ef080e6fe371f8d878c10ff4512e35fcae90d1b987c149c4ac47f09127edd0b8b189249b3085a4d1f5d6b34313  php-spx-0.4.17.tar.gz
"
